import {
	defineStore
} from "pinia";
import {
	ref
} from "vue";

export const shopStore = defineStore("shop", () => {
		//存放对象
		//存放shop的基本信息
		const shop = ref({});
		//拷贝obj的所有内容赋值给shop
		const setShop = (obj) => {
			shop.value = obj
		}
		//清空容器中的值
		const removeShop = () => {
			shop.value = {}
		}

		return {
			shop,
			setShop,
			removeShop
		}
	},
	//设置参数的持久化
	{
		persist: {
			storage: {
				//调整为兼容多端的api，不同的程序中，存放的位置不同
				setItem(key, value) {
					uni.setStorageSync(key, value) // [!code warning]
				},
				getItem(key) {
					return uni.getStorageSync(key) // [!code warning]
				},
			}
		}
	}
	
)